<div style="margin:10px 10px 0px 0px;">
<table class="am-table am-table-bordered am-table-striped am-table-compact am-table-hover am-table-centered wjmx">
  <thead>
  <tr>
    <th>时间</th>
    <th>类型</th>
    <th>玩法</th>
    <th>下注金额</th>
    <th>退水</th>
    <th>可赢金额</th>
  </tr>
  </thead>
  <tbody>
  </tbody>
</table>
</div>

<div class="sum">
  下注总金额：<span class="red">0.00</span><br/>
  可赢总金额：<span class="red">0.00</span>
</div>
<div class="clear"></div>

<style type="text/css">
.sum {
        float: right;
        width: 200px;
        color: black;
        font-size: 16px;
        margin-bottom: 10px;
    }
</style>

<script>
    // 拉取未结明细列表
    Lottery.cb = function() {
        stopLoading();
        var table = $("table.wjmx tbody");
        table.empty();

        if (isEmpty(context.bets)) {
            table.html("<tr><td colspan='6'>暂无数据！</td></tr>");
            $(".sum").html('下注总金额：<span class="red">0.00</span><br/>可赢总金额：<span class="red">0.00</span>');
            return;
        }

        var hasData = false;
        var t1 = 0, t2 = 0;
        for (var type in context.bets) {
            var bets = context.bets[type];
            for (var issue in bets) {
                var list = bets[issue];
                var data = Lottery.combineGroup(list);

                for (var target in data) {
                    var o = data[target];
                    if (o.state != 0) continue;
                    var target = o.target;
                    if (o.group) {
                        var target = o.group.split("_")[0];
                    }
                    else
                        var target = Util.convertTarget(o.type, o.target);
                    var tr = $("<tr></tr>");
                    tr.append("<td>" + new Date(o.time).Format("yyyy-MM-dd HH:mm") + "</td>");
                    tr.append("<td>" + get_game_display_name(type) + " 第<span class='blue'>" + issue + "</span>期</td>");
                    tr.append("<td><span class='blue'>" + target + "<span>@<span class='gray'>" + o.rate + "</span></td>");
                    tr.append("<td class='red'>" + (o.amount / 100) + "</td>");
                    tr.append("<td>" + (o.back ? o.back*100 : 0) + "%</td>");

                    // 计算可赢金额
                    var v = Math.round(o.amount * (o.rate - 1)) / 100;
                    tr.append("<td class='red'>" + v + "</td>");
                    table.append(tr);
                    hasData = true;
                    t1 += o.amount;
                    t2 += v;
                }
            }
        }
        if (!hasData) table.html("<tr><td colspan='6'>暂无数据！</td></tr>");
        $(".sum").html('下注总金额：<span class="red">' + (t1/100).toFixed(2) +
            '</span><br/>可赢总金额：<span class="red">' + (Math.round(t2 * 100)/100).toFixed(2) +
            '</span>');
    };
    startLoading();
    Lottery.refresh_uncheck();

</script>